apiVersion: jaegertracing.io/v1
kind: Jaeger
metadata:
  name: jaeger
  namespace: istio-system
spec:
  ingress:
    enabled: false
  agent:
    image: {{ jaeger_agent_repo }}:{{ jaeger_agent_tag }}
  collector:
    image: {{ jaeger_collector_repo }}:{{ jaeger_collector_tag }}
    maxReplicas: 5
    resources:
      limits:
        cpu: {{ servicemesh.jaeger.resources.limits.cpu | default("100m") }}
        memory: {{ servicemesh.jaeger.resources.limits.memory | default("128Mi") }}
      requests:
        cpu: {{ servicemesh.jaeger.resources.requests.cpu | default("20m") }}
        memory: {{ servicemesh.jaeger.resources.requests.memory | default("50Mi") }}
  query:
    image: {{ jaeger_query_repo }}:{{ jaeger_query_tag }}
  storage:
    dependencies:
      enabled: false
    esIndexCleaner:
      enabled: true
      image: {{ jaeger_es_cleaner_repo }}:{{ jaeger_es_cleaner_tag }}
    options:
      es:
{% if common.es is defined and common.es.enabled is defined and common.es.enabled  %}
        index-prefix: {{ common.es.elkPrefix }}
{% else %}
        index-prefix: {{ common.opensearch.opensearchPrefix }}
        tls:
          enabled: true
          skip-host-verify: true
        version: 7
{% endif %}
{% if common.es.externalElasticsearchHost is defined and common.es.externalElasticsearchPort is defined and common.es.externalElasticsearchHost != "" and common.es.externalElasticsearchPort != "" %}
        server-urls: http://{{ common.es.externalElasticsearchHost }}:{{ common.es.externalElasticsearchPort }}
{% elif common.opensearch.externalOpensearchHost is defined and common.opensearch.externalOpensearchPort is defined and common.opensearch.externalOpensearchHost != "" and common.opensearch.externalOpensearchPort != ""%}
        server-urls: https://{{ common.opensearch.externalOpensearchHost }}:{{ common.opensearch.externalOpensearchPort }}
{% elif common.es is defined and common.es.enabled is defined and common.es.enabled %}
        server-urls: http://elasticsearch-logging-data.kubesphere-logging-system.svc:9200
{% else %}
        server-urls: https://opensearch-cluster-data.kubesphere-logging-system.svc:9200
{% endif %}
{% if common.es.basicAuth is defined and common.es.basicAuth.enabled is defined and common.es.basicAuth.enabled is true and common.es.basicAuth.username is defined and common.es.basicAuth.password is defined and common.es.basicAuth.username != "" and common.es.basicAuth.password != "" %}
    secretName: jaeger-secret
{% elif common.opensearch.basicAuth is defined and common.opensearch.basicAuth.enabled is defined and common.opensearch.basicAuth.enabled is true and common.opensearch.basicAuth.username is defined and common.opensearch.basicAuth.password is defined and common.opensearch.basicAuth.username != "" and common.opensearch.basicAuth.password != "" %}
    secretName: jaeger-secret
{% endif %}
    type: elasticsearch
  strategy: production

---
